2e5a5109b48cf922acea597b57b4eb04ceb3c0cd,plugins/org.eclipse.xtend.ide/src/org/eclipse/xtend/ide/quickfix/XtendQuickfixProvider.java,XtendQuickfixProvider,createXtendLinkingIssueResolutions,#Issue#IssueResolutionAcceptor#,182
Before Change
IXtextDocument xtextDocument = modificationContext.getXtextDocument();
if(issue.getData() != null && xtextDocument != null){
final String elementName = issue.getData()[0];
xtextDocument.modify(new IUnitOfWork.Void<XtextResource>(){
@SuppressWarnings("null")
@Override
public void process(XtextResource state) throws Exception {
EObject eObject = state.getEObject(issue.getUriToProblem().fragment());
if(eObject instanceof XAbstractFeatureCall){
XAbstractFeatureCall call = (XAbstractFeatureCall) eObject;
EList<XExpression> explicitArguments = call.getExplicitArguments();
StringBuilderBasedAppendable appendable = new StringBuilderBasedAppendable(new ImportManager(true));
getTypeArgumentString(call, appendable);
JvmTypeReference expectedType = typeProvider.getExpectedType(call);
if(expectedType != null && expectedType.getType() != null)
appendable.append(expectedType.getSimpleName()).append(" ");
appendable.append(elementName);
computeArgumentString(call, false, appendable);
boolean isExtension = false;
if(call instanceof XMemberFeatureCall)
isExtension = ((XMemberFeatureCall) call).getMemberCallTarget() != null;
boolean isSetter = false;
if(call instanceof XAssignment)
isSetter = true;
createNewXtendFunction(elementName, appendable.toString(), isExtension, isSetter,expectedType, issue, issueResolutionAcceptor, modificationContext);
if (expectedType != null && expectedType.getType() != null && explicitArguments.size() == 0){
createNewXtendField(elementName, expectedType, issue, issueResolutionAcceptor, modificationContext);
createNewLocalVariable(elementName, expectedType, issue, issueResolutionAcceptor, modificationContext);
}
}
}
});
}
}
After Change
IXtextDocument xtextDocument = modificationContext.getXtextDocument();
if(issue.getData() != null && xtextDocument != null){
final String elementName = issue.getData()[0];
if(elementName != null)
xtextDocument.modify(new IUnitOfWork.Void<XtextResource>(){
@Override
public void process(XtextResource state) throws Exception {
EObject eObject = state.getEObject(issue.getUriToProblem().fragment());
if(eObject instanceof XAbstractFeatureCall){
XAbstractFeatureCall call = (XAbstractFeatureCall) eObject;
EList<XExpression> explicitArguments = call.getExplicitArguments();
StringBuilderBasedAppendable appendable = new StringBuilderBasedAppendable(new ImportManager(true));
computeTypeArguments(call, call.getTypeArguments(), appendable);
// ------ExpectedType computation
JvmTypeReference expectedType = typeProvider.getExpectedType(call);
UnboundTypeParameterSubstitutor substitutor = new UnboundTypeParameterSubstitutor(Collections.<JvmTypeParameter, JvmTypeReference>emptyMap(), computationServices);
JvmTypeReference resolvedExpectedType= substitutor.substitute(expectedType);
if(resolvedExpectedType != null && resolvedExpectedType.getType() != null){
typeRefSerializer.serialize(resolvedExpectedType, call, appendable);
appendable.append(" ");
}
// ------ END
appendable.append(elementName);
computeArgumentString(call, false, appendable);
boolean isExtension = false;
if(call instanceof XMemberFeatureCall)
isExtension = ((XMemberFeatureCall) call).getMemberCallTarget() != null;
boolean isSetter = false;
if(call instanceof XAssignment)
isSetter = true;
createNewXtendFunction(elementName, appendable.toString(), isExtension, isSetter, resolvedExpectedType, issue, issueResolutionAcceptor, modificationContext);
if (resolvedExpectedType != null && resolvedExpectedType.getType() != null && explicitArguments.size() == 0){
ICompositeNode callNode = NodeModelUtils.getNode(call);
if(callNode != null && !callNode.getText().endsWith(")")){
createNewXtendField(elementName, resolvedExpectedType, issue, issueResolutionAcceptor, modificationContext);
createNewLocalVariable(elementName, resolvedExpectedType, issue, issueResolutionAcceptor, modificationContext);
}
}
}
}
});
}
}